<?php

/**
 * AdminAction
 * 
 * @package 没有项目被加载
 * @author jhfnetboy
 * @copyright 2011
 * @version $Id$
 * @access public
 */
class AdminAction extends Action
{	
    /**
     * AdminAction::index()
     * 
     * @return 显示
     */
     
    public function index()
    {
		//$this->assign('baseUrl', "http://www.taogezi.org");
		$this->assign('baseUrl', "http://localhost/tgz");		
	    $this->display('AuthACL:index');
    }

    /**
     * AdminAction::ajaxGet()
     * 
     * @return
     */
    public function ajaxGet()
    {
        $msgid = $_POST['msgid'];
        $fun = $_POST['pfunc'];
		//dump($_POST);
		$param1 = isset($_POST['param1'])?$_POST['param1']:'';
		$param2 = isset($_POST['param2'])?$_POST['param2']:'';		
		$rt = $fun($msgid,$param1,$param2);//参数为函数名
		
        if ($rt)
        {
	            echo ajaxrt('ok','ok',$rt);
        } else
        {
			echo ajaxrt('error','出错：消息id'.$msgid,$rt);
        }
    }
	
	/**
	 * AdminAction::checkPay()
	 * 创建项目，付款，insert两个表
	 * @return
	 */
	public function checkPay(){
	       checkSec(1);
		$id_user = $_SESSION['UserInfo']['id'];
		$User = D('User');
		$rt = $User->where("id = '$id_user'")->find();
		
		if(count($rt))
		{	
		$tt = (trim($rt['paySecret'])==$_POST['paySecret'])?true:false;
        
		if($tt)
            {
                $ttt= pay2Sys($id_user,$_POST['payNum'],$_POST['page'],$_POST['geziP']);                
                if($ttt)
                {
                $newnow = getGezis();  
                 setcookie('totalGezi__', $newnow[0], time() + 3600 * 24 * 7, '/');   
                 echo ajaxrt( 'ok','支付成功,项目创建OK',$ttt);
                }
                else
                echo ajaxrt( 'error','支付失败,项目无法创建',$ttt);
            }//支付密语正确，划账到系统
            else
		  {echo ajaxrt('error','支付密语不正确,请重新创建',NULL);}	
		
		}
		else
		echo ajaxrt('error','后台错误,请重新创建',NULL);		
	}
	



}
?>